package com.changcheng.explorer.dialog;

import com.changcheng.explorer.R;
import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

/**
 * 创建文件对话框
 * @author Administrator
 *
 */
public class FSCreateFileDialog extends Dialog {

	@SuppressWarnings("unused")
	private static final String TAG = "FSCreateFileDialog";
	// 文件名
	private String name;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public FSCreateFileDialog(Context context, String title) {
		super(context);
		this.setContentView(R.layout.file_create_dri_dialog);
		this.setCancelable(true);
		this.setTitle(title);
		// 取消按钮 
		Button cancel = (Button) this
				.findViewById(R.id.file_bt_create_dir_cancel);
		cancel.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				FSCreateFileDialog.this.cancel();				
			}
		});
		Button ok = (Button) this.findViewById(R.id.file_bt_create_dir_ok);
		
		// 确认按钮 
		ok.setOnClickListener(new View.OnClickListener(){
			@Override
			public void onClick(View v) {
				EditText editText = (EditText) FSCreateFileDialog.this.findViewById(R.id.file_et_create_name);
				FSCreateFileDialog.this.name = editText.getText().toString(); 
				FSCreateFileDialog.this.dismiss();
			}});
	}
}
